S = "Pame"
for i in range(len(S)):
    print(S[-i],end='')

print("\n")
for i in range(8):
    print(i, end='')